import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router';

const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    scrollBehavior() {
        return { top: 0 };
    },
    routes: [
        {
            path: '/',
            component: () => import('@/layout/layout.vue'),
            redirect: '/home',
            children: [
                {
                    path: '/home',
                    name: 'home',
                    component: () => import('@/views/home/home.vue'),
                    meta: {
                        title: '首页数据'
                    }
                },
                {
                    path: '/institute',
                    name: 'institute',
                    component: () => import('@/views/institute/institute.vue'),
                    meta: {
                        title: '检测机构管理'
                    }
                },
                {
                    path: '/construction',
                    name: 'construction',
                    component: () => import('@/views/construction/construction.vue'),
                    meta: {
                        title: '施工单位管理'
                    }
                },
                {
                    path: '/supervision',
                    name: 'supervision',
                    component: () => import('@/views/supervision/supervision.vue'),
                    meta: {
                        title: '监理单位管理'
                    }
                },
                {
                    path: '/project',
                    name: 'project',
                    component: () => import('@/views/project/project.vue'),
                    meta: {
                        title: '工程登记管理'
                    }
                },
                {
                    path: '/online',
                    name: 'online',
                    component: () => import('@/views/online/online.vue'),
                    meta: {
                        title: '在线委托管理'
                    }
                },
                {
                    path: '/witness',
                    name: 'witness',
                    component: () => import('@/views/witness/witness.vue'),
                    meta: {
                        title: '见证取样监管'
                    }
                },
                {
                    path: '/foundation',
                    name: 'foundation',
                    component: () => import('@/views/foundation/foundation.vue'),
                    meta: {
                        title: '地基基础管理'
                    }
                },
                {
                    path: '/test',
                    name: 'test',
                    component: () => import('@/views/test/test.vue'),
                    meta: {
                        title: '试验数据管理'
                    }
                },
                {
                    path: '/report',
                    name: 'report',
                    component: () => import('@/views/report/report.vue'),
                    meta: {
                        title: '特殊报告查询'
                    }
                },
                {
                    path: '/modify',
                    name: 'modify',
                    component: () => import('@/views/modify/modify.vue'),
                    meta: {
                        title: '修改信息查询'
                    }
                },
                {
                    path: '/website',
                    name: 'website',
                    component: () => import('@/views/website/website.vue'),
                    meta: {
                        title: '网站数据维护'
                    }
                },
                {
                    path: '/user',
                    name: 'user',
                    component: () => import('@/views/user/user.vue'),
                    meta: {
                        title: '网站用户管理'
                    }
                }
            ]
        }
    ]
});

export default router;
